﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>城市管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="/hdocs/css/cms.css" rel="stylesheet" type="text/css"/>
<script src="/hdocs/js/cms.js" type="text/javascript"></script>
<script src="/hdocs/js/prototype.js" type="text/javascript"></script>
<script src="/hdocs/js/region.js" type="text/javascript"></script>
<script type="text/javascript">
window.onload = function() {
	ZebraTable.stripe('citys_table');
}
</script>
</head>
<body>
	<form id="mainForm" name="mainForm" action="/region/cityQuery.jsp" method="post">
		<table class="formlist" width="750px">
			<tr>
				<th>所属省：</th>
				<td style="text-align:left;">
					<select name="province" id="province">
						<option value="">---请选择---</option> 
						#foreach($p in $provinceList)
						<option value="$p.name" #if($p.name==$!city.province) selected #end>$p.name</option>
						#end
					</select>
				</td>
				<th>城市：</th>
				<td style="text-align:left;">
					<input type="text" size="15" name="name" value="$!city.name"/>
				</td>
				<td style="text-align:left;">
					<input type="submit" class="cms_button" value="查询"/>
				</td>
				<td style="text-align:right;">
					<input type="button" class="cms_button" onclick="window.location.href='/region/cityAddInit.jsp'" value="添加"/>
				</td>
			</tr>
		</table>
	</form>
	<form id="optionForm" name="optionForm" action="/region/cityDelete.jsp" method="post">
		<input type="hidden" id="cityId" name="id" value=""/>
		<input type="hidden" name="province" value="$!city.province"/>
		<input type="hidden" name="name" value="$!city.name"/>
	</form>
	<table id="citys_table" class="datalist" width="100%">
		<thead>
			<tr>
				<th>ID</th>
				<th>城市</th>
				<th>所属省份</th>
				<th>操作</th>
			</tr>
		</thead>
		<tbody>
			#foreach($city in $cityList)
			<tr>
				<td>$city.id</td>
				<td>$city.name</td>
				<td>$city.province</td>
				<td>
					<a href="javascript:void(0)">编辑</a>
					<span>|</span>
					<a href="javascript:deleteCity($city.id)">删除</a>
				</td>
			</tr>
			#end
		</tbody>
	</table>
</body>
</html>
<script type="text/javascript">
function deleteCity(id){
	alert(id);
	var cityId = document.getElementById("cityId");
	cityId.value=id;
	var optionForm = document.getElementById("optionForm");
	optionForm.submit();
}
</script>